<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <title>找回密码 <!--{$site.title}-->_<!--{$site.seotitle}--></title>
    <meta name="keywords" content="<!--{$site.keywords}-->" />
    <meta name="description" content="<!--{$site.description}-->"/>
    <!--{iCMS:public:ui}-->
    <script src="<!--{$site.urls.ui}-->/iCMS.login-6.0.0.js"></script>
    <script>
    $(function(){
      $("#iCMS_findpwd").click(function(event) {
        var ua = $('input[name="uname"]'),uname = $('input[name="uname"]').val();
        if (!uname) {
          ua.focus();
          iCMS.tip(ua, '<i class="fa fa-times-circle"></i> 请填写您注册时所用的邮箱！');
          return false;
        }
        var pattern = /^([a-zA-Z0-9._-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9._-])+/;
        if (!pattern.test(uname)) {
          ua.focus();
          iCMS.tip(ua, '<i class="fa fa-times-circle"></i> 电子邮箱格式不正确！');
          return false;
        }
        var seccode = $('input[name="seccode"]').val();
        if (!seccode) {
          $('input[name="seccode"]').focus();
          iCMS.tip($('input[name="seccode"]'), '<i class="fa fa-times-circle"></i> 请填写验证码！');
          return false;
        }
        $.get(iCMS.api('user',"&do=check"), {name:'username',value: uname},
          function(c) {
            if (c.code) {
              $("#iCMS_seccode_img").click();
              iCMS.tip(ua, '<i class="fa fa-times-circle"></i> 您输入的邮箱不存在！请重新输入！');
            }else{
              var param = {'action':'findpwd','uname':uname,'seccode':seccode}
              $.post(iCMS.api('user'), param, function(ret) {
                if (ret.code) {
                  iCMS.tip(ua, '<i class="fa fa-check-circle" style="color: #33B800;"></i> '+ret.msg);
                } else {
                  iCMS.tip(ua, '<i class="fa fa-times-circle"></i> '+ret.msg);
                }
              }, 'json');
            }
          }, 'json');

      });
    })
    </script>
  </head>
  <body class="iCMS-mobile">
    <nav id="header" class="navbar navbar-default" role="navigation">
      <div class="container-fluid">
        <div class="navbar-header">
          <a class="btn btn-default header-back" href="<!--{$forward}-->"><i class="fa fa-arrow-left"></i></a>
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#iCMS-menu-box">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          </button>
          <h3 class="header-title">找回密码</h1>
        </div>
      </div>
    </nav>
    <div class="container">
      <div class="wrapper login_reg_wrapper" id="iCMS-login-page">
          <div class="logo"><a href="<!--{$site.url}-->"><img src="<!--{$site.urls.ui}-->/img/iCMS.logo-6.0.png" width="180"/></a></div>
          <div class="form-group">
            <label for="login_uname">邮箱</label>
            <input type="text" placeholder="请填写你注册时所用的邮箱" data-container=".uname_tip" name="uname" id="login_uname" class="iCMS_login_uname form-control">
            <span class="help-block uname_tip"></span>
          </div>
          <div class="form-group">
            <input type="text" maxlength="4" name="seccode" class="iCMS_login_seccode iCMS_seccode form-control" placeholder="验证码"  data-container=".seccode_tip" >
            <img src="<!--{iCMS:router url='/api/public/seccode'}-->" alt="验证码" class="iCMS_seccode_img r3"/>
            <a href="javascript:;" class="iCMS_seccode_text" style="float: none">换一张</a>
            <span class="help-block seccode_tip">请输入图片中的字符!</span>
          </div>
          <div class="clearfix mt10">
            <button type="submit" class="btn btn-primary btn-lg btn-block iCMS_login_btn" id="iCMS_findpwd">提 交</button>
          </div>
          <div class="clearfix mb20"></div>
      </div>
    </div>
    <!--{include file="{iTPL}/footer.htm"}-->
  </body>
</html>
